package com.edu.exam.entity.examination.paper;

import com.edu.exam.enums.examination.ApplicationStatus;
import com.edu.exam.enums.examination.ReviewResult;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 特殊考试申请实体类
 * 所属模块：E-01 考试执行模块
 * 对应数据库表：special_exam_application
 *
 * <p>特殊考试申请实体类，存储学生特殊考试申请信息。
 * 用于管理补考、缓考、重修等特殊考试类型的申请和审批流程。</p>
 *
 * @author System
 * @version 1.0.0
 */
@Entity
@Data
@EqualsAndHashCode(callSuper = false)
public class SpecialExamApplication {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "application_no", length = 64, unique = true, nullable = false)
    private String applicationNo;

    @Column(name = "student_id", length = 32, nullable = false)
    private String studentId;

    @Column(name = "course_id", length = 32, nullable = false)
    private String courseId;

    @Column(name = "type_code", length = 32, nullable = false)
    private String typeCode;

    @Column(name = "reason", columnDefinition = "TEXT")
    private String reason;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", length = 32, nullable = false)
    private ApplicationStatus status;

    @Column(name = "certificate_urls", columnDefinition = "TEXT")
    private String certificateUrls;

    @Column(name = "attachment_ids")
    private String attachmentIds;

    @CreationTimestamp
    @Column(name = "application_time", nullable = false, updatable = false)
    private LocalDateTime applicationTime;

    @Column(name = "reviewer_id", length = 64)
    private String reviewerId;

    @Column(name = "review_time")
    private LocalDateTime reviewTime;

    @Column(name = "reviewer_comment", columnDefinition = "TEXT")
    private String reviewerComment;

    @Enumerated(EnumType.STRING)
    @Column(name = "review_result", length = 32)
    private ReviewResult reviewResult;

    @Column(name = "final_reviewer_id", length = 64)
    private String finalReviewerId;

    @Column(name = "final_review_time")
    private LocalDateTime finalReviewTime;

    @Column(name = "final_reviewer_comment", columnDefinition = "TEXT")
    private String finalReviewerComment;

    @Enumerated(EnumType.STRING)
    @Column(name = "final_review_result", length = 32)
    private ReviewResult finalReviewResult;

    @Column(name = "exam_arrangement_id", length = 64)
    private String examArrangementId;

    @Column(name = "created_by", length = 64)
    private String createdBy;

    @UpdateTimestamp
    @Column(name = "update_time")
    private LocalDateTime updateTime;

    @Version
    @Column(name = "version", nullable = false)
    private Integer version = 1;

}